package com.atguigu.gmall.common.util;

/***
 * 商城微服务本地线程
 */
public class GmallThreadLocalUtils {
    private static final ThreadLocal<String> threadLocal = new ThreadLocal<>();

    /**
     * 设置
     * @param username
     */
    public static void set(String username){
        threadLocal.set(username);
    }

    /**
     * 获取值
     * @return
     */
    public static String get(){
        return threadLocal.get();
    }

    /**
     * 清除线程中的值
     */
    public static void clear(){
        threadLocal.remove();
    }
}
